<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
	  xmlns:a4j="http://richfaces.org/a4j">

	<body>
	
		<ui:composition template="../templates/template.xhtml">
		
			<ui:define name="title">Consultar Servico</ui:define>

			<ui:define name="content">
				
				<rich:panel>
					<f:facet name="header">Consultar Servico</f:facet>
					<a4j:form>
						<h:panelGrid columns="2">
						<h:commandButton action="#{servicoBackBean.obterListaServico}" value="#{bundle.servico_btn_consultar}" />
						<a4j:commandButton value="#{bundle.servico_btn_novo}" actionListener="#{servicoBackBean.listenerIrInserirServico}" id="btnNovo" reRender="formServicoManter">
							<rich:componentControl for="manterServico" attachTo="btnNovo" operation="show" event="onclick" />
						</a4j:commandButton>
						</h:panelGrid>
						<div class="linha"/>
						
						
						<rich:dataTable value="#{servicoBackBean.servicoFormBean.listaServico}" var="servico" id="gridServico" rows="13" align="center" width="100%">
						
							<rich:column filterBy="#{servico.codigo}">
								<f:facet name="header">
									<h:outputText value="#{bundle.servico_codigo}"/>
								</f:facet>
								<h:outputText value="#{servico.codigo}"/>
							</rich:column>
							
							<rich:column filterBy="#{servico.descricao}">
								<f:facet name="header">
									<h:outputText value="#{bundle.servico_descricao}"/>
								</f:facet>
								<h:outputText value="#{servico.descricao}"/>
							</rich:column>
							
							<rich:column filterBy="#{servico.categoriaVO.descricao}">
								<f:facet name="header">
									<h:outputText value="#{bundle.servico_categoria}"/>
								</f:facet>
								<h:outputText value="#{servico.categoriaVO.descricao}"/>
							</rich:column>
							
							<rich:column>
								<a4j:commandButton id="btnEditar" actionListener="#{servicoBackBean.listenerIrEditarServico}" value="#{bundle.servico_btn_editar}" reRender="formServicoManter">
									<f:param id="codigoServicoEditar" name="codigoServicoEditar" value="#{servico.codigo}" />
									<rich:componentControl for="manterServico" attachTo="btnEditar" operation="show" event="onclick" />
								</a4j:commandButton>
							</rich:column>
							
							<rich:column>
								<a4j:commandButton id="btnExcluir" actionListener="#{servicoBackBean.listenerIrExcluirServico}" value="#{bundle.servico_btn_excluir}" reRender="formServicoManter">
									<f:param id="codigoServicoExcluir" name="codigoServicoExcluir" value="#{servico.codigo}" />
									<rich:componentControl for="manterServico" attachTo="btnExcluir" operation="show" event="onclick" />
								</a4j:commandButton>
							</rich:column>
							
							<rich:column>
								<a4j:commandButton id="btnVisualizar" actionListener="#{servicoBackBean.listenerIrVisualizarServico}" value="#{bundle.servico_btn_visualizar}" reRender="formServicoManter">
									<f:param id="codigoServicoVisualizar" name="codigoServicoVisualizar" value="#{servico.codigo}" />
									<rich:componentControl for="manterServico" attachTo="btnVisualizar" operation="show" event="onclick" />
								</a4j:commandButton>
							</rich:column>
						</rich:dataTable>
						<rich:datascroller for="gridServico" maxPages="10"/>
						
					</a4j:form>
					
				</rich:panel>
				
				<ui:include src="/pages/servico/manterServico.xhtml" />
				
			</ui:define>
			
		</ui:composition>
		
	</body>

</html>